class_name FlowFieldPathFinding_GridNode

var x:int
var y:int
# 当前格子消耗
var cost:float:
	set(value):
		if value > cost:
			cost = value
# 最终消耗
var final_cost:float:
	set(value):
		final_cost = value
var is_walkable:bool = true:
	set(value):
		if is_walkable:
			is_walkable = value
			if not is_walkable:
				cost = INF
				final_cost = INF
var dir:Vector2
var update_id:int
# 目标节点
var target_grid_node:FlowFieldPathFinding_GridNode

func _init(x:int,y:int,is_walkable:bool,cost:float = 1) -> void:
	self.x = x
	self.y = y
	self.is_walkable = is_walkable
	self.cost = cost
	reset()
func get_pos_vec() -> Vector2i:
	return Vector2i(x,y)
func reset():
	self.final_cost = INF
	self.dir = Vector2.ZERO
	self.update_id = -1
	target_grid_node = null
